package com.wa.annotations.lifecycle;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Data
@AllArgsConstructor
public class LifeCycleAllPrototype implements InitializingBean, DisposableBean {
    public void init() {
        System.out.println("LifeCycleAllPrototype init-method方法");
    }

    public void destroyMethod() {
        System.out.println("LifeCycleAllPrototype destroy-method方法");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("LifeCycleAllPrototype InitializingBean.afterPropertiesSet方法");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("LifeCycleAllPrototype DisposableBean.destroy方法");
    }

    @PostConstruct
    public void postConstruct() {
        System.out.println("LifeCycleAllPrototype PostConstruct注解");
    }

    @PreDestroy
    public void preDestroy() {
        System.out.println("LifeCycleAllPrototype preDestroy注解");
    }
}


